
import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * tester for the bank class.
 * @author Kyle Scharnhorst/Kristopher Gooding
 * @version 04/25/2014
 */
public class BankTest {
	
	/**bank object to test.*/
	Bank bank;

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		bank = new Bank("Death and Taxes");
	}

	/**
	 * Test method for {@link Bank#Bank(java.lang.String)}.
	 */
	@Test
	public void testBank() {
		assertTrue(bank.getName().equals("Death and Taxes"));
	}

	/**
	 * Test method for {@link Bank#openSimpleCheckingAccount()}.
	 */
	@Test
	public void testOpenSimpleCheckingAccount() {
		bank.openSimpleCheckingAccount();
		bank.openSimpleCheckingAccount();
		bank.openSimpleCheckingAccount();
		// CheckingAccount newAccount = new CheckingAccount("Bob Smith",
		// "1 Main St.", "12345", "Tacoma", "USA");
		// bank.getfCheckingAccounts().contains(newAccount);
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getName().equals("Bob Smith"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getStreet().equals("1 Main St."));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getZipCode().equals("12345"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getTown().equals("Tacoma"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getCountry().equals("USA"));
	}

	/**
	 * Test method for {@link Bank#openFullPackage()}.
	 */
	@Test
	public void testOpenFullPackage() {
		bank.openFullPackage();

		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getName().equals("Bob Smith"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getStreet().equals("1 Main St."));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getZipCode().equals("12345"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getTown().equals("Tacoma"));
		assertTrue(bank.getfCheckingAccounts().firstElement().getMember()
				.getAddress().getCountry().equals("USA"));

		assertTrue(bank.getfSavingAccounts().firstElement().getMember()
				.getName().equals("Bob Smith"));
		assertTrue(bank.getfSavingAccounts().firstElement().getMember()
				.getAddress().getStreet().equals("1 Main St."));
		assertTrue(bank.getfSavingAccounts().firstElement().getMember()
				.getAddress().getZipCode().equals("12345"));
		assertTrue(bank.getfSavingAccounts().firstElement().getMember()
				.getAddress().getTown().equals("Tacoma"));
		assertTrue(bank.getfSavingAccounts().firstElement().getMember()
				.getAddress().getCountry().equals("USA"));
	}

	/**
	 * Test method for {@link Bank#withdrawMoney(int, double)}.
	 */
	@Test
	public void testWithdrawMoney() {
		bank.openSimpleCheckingAccount();
		int accountNumber = bank.getfCheckingAccounts().firstElement()
				.getAccountNumber();
		assertFalse(bank.withdrawMoney(accountNumber, 10));
	}

}
